﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Medianamik.Globalization;
using NUnit.Framework;

namespace Medianamik.Tests.Unit.Globalization
{
    [TestFixture]
    public class ResourceTest
    {
        [Test]
        public void Resource_should_initialize_right_values()
        {
            var expectedId = "Id";
            var expectedCulture = "culture";
            var expectedValue = "value";
            var expectedResourceSet = "set";
            var expectedModifiedOn = DateTime.Now;

            var actualResource = new Resource(expectedId, expectedCulture, expectedValue, expectedResourceSet, expectedModifiedOn);

            Assert.That(actualResource.Id, Is.EqualTo(expectedId));
            Assert.That(actualResource.CultureName, Is.EqualTo(expectedCulture));
            Assert.That(actualResource.Value, Is.EqualTo(expectedValue));
            Assert.That(actualResource.ResourceSet, Is.EqualTo(expectedResourceSet));
            Assert.That(actualResource.ModifiedOn, Is.EqualTo(expectedModifiedOn));
        }
        [Test]
        public void Resource_should_throw_ArgumentNullException_when_anyOf_id_CultureName_Value_resourceSet_are_null()
        {
            var expectedId = "Id";
            var expectedCulture = "culture";
            var expectedValue = "value";
            var expectedResourceSet = "set";

            Assert.Throws<ArgumentNullException>(() => new Resource(null, expectedCulture, expectedValue, expectedResourceSet));
            Assert.Throws<ArgumentNullException>(() => new Resource(expectedId, null, expectedValue, expectedResourceSet));
            Assert.Throws<ArgumentNullException>(() => new Resource(expectedId, expectedCulture, expectedValue, null));
        }
        [Test]
        public void Resource_should_throw_ArgumentException_when_id_or_resourceSet_are_empty()
        {
            var expectedId = "Id";
            var expectedCulture = "culture";
            var expectedValue = "value";
            var expectedResourceSet = "set";

            Assert.Throws<ArgumentException>(() => new Resource(String.Empty, expectedCulture, expectedValue, expectedResourceSet));
            Assert.Throws<ArgumentException>(() => new Resource(expectedId, expectedCulture, expectedValue, String.Empty));
        }
    }
}